
<template>
  <el-form class="Login" ref="form" :model="form" label-width="120px">
    <el-form-item label="登录名">
      <el-input v-model="form.userName"></el-input>
    </el-form-item>
    <el-form-item label="密码">
      <el-input v-model="form.passWord" type="password"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">提交</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
// const qs = require('qs');
export default {
  data() {
    return {
      form: {
        userName: '',
        passWord:''
      },
    }
  },
  methods: {
    onSubmit() {
        this.$postJson('/api/demo/register',this.form)
        .then((response) =>{          //这里使用了ES6的语法
                console.log(response)       //请求成功返回的数据
            }).catch((error) =>{
                console.log(error)       //请求失败返回的数据
            })
    //   register
    },
  },
}
</script>